package com.example.understand_compose1.testcase_activity

import android.app.Activity
import android.content.ComponentName
import android.content.Intent
import android.os.Bundle
import android.view.View
import com.example.understand_compose1.R

class FetJumpToBrowserActivity:Activity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.skip_to_browser)
    }

    // 点击按钮是跳转到浏览器
    // Component = cmp = com.android.browser/com.android.browser.BrowserActivity
    // 其实组件名称就是 包名/.类的名称
    fun clicktobrowser(view: View) {
        /*第一种写法
        val toBrowserIntent = Intent()
        toBrowserIntent.setPackage("com.android.browser")
        toBrowserIntent.setClassName("com.android.browser", "com.android.browser.BrowserActivity")

        startActivity(toBrowserIntent)
         */
        // 第二种写法
        val cmpName = ComponentName("com.android.browser", "com.android.browser.BrowserActivity")
        val toBrowserIntent = Intent()
        toBrowserIntent.setComponent(cmpName)
        startActivity(toBrowserIntent)


    }

    fun clicktowechatlike(view: View) {
//        val toFetWechatIntent = Intent(view.context, FetWechatActivity::class.java)
//        startActivity(toFetWechatIntent)
    }

//    fun clickToLoadImg(view: View) {
//        val toLoadImgIntent = Intent(view.context, FetLoadImgActivity::class.java)
//        startActivity(toLoadImgIntent)
//    }
}